import React from 'react'
import { Text, StyleSheet, View } from 'react-native'
import PropTypes from 'prop-types'
import { ScaleT, ScaleS } from 'src/utils/ScreenUtil'
import CustomButton from 'src/components/button/CustomButton'

export default function ContentTitle (props) {
  const {
    mainTitleLabel, secondTitleLabel, onPress, rightText, style, hideRightText
  } = props
  return (
    <View style={style}>
      {secondTitleLabel && <Text style={styles.myResumeViewFirst}>{secondTitleLabel}</Text>}
      <View style={styles.myResume}>
        <Text style={styles.myResumeLabel}>{mainTitleLabel}</Text>
        {
          !hideRightText && (<CustomButton style={styles.previewViw} onPress={onPress}>
            <Text style={styles.preview}>{rightText}</Text>
          </CustomButton>)
        }
      </View>
    </View>
  )
}

ContentTitle.defaultProps = {
  hideRightText: false
}
ContentTitle.propTypes = {
  mainTitleLabel: PropTypes.string,
  secondTitleLabel: PropTypes.string,
  rightText: PropTypes.string,
  onPress: PropTypes.func,
  style: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
  hideRightText: PropTypes.bool
}
ContentTitle.defaultProps = {}
const styles = StyleSheet.create({
  myResumeViewFirst: {
    color: 'rgba(140,140,142,0.2831)',
    fontSize: ScaleT(16),
    fontWeight: '400'
  },
  myResume: {
    flexDirection: 'row',
    marginTop: ScaleS(8)
  },
  myResumeLabel: {
    flex: 1,
    color: '#000000',
    fontSize: ScaleT(25),
    fontWeight: '500'
  },
  previewViw: {
    paddingHorizontal: ScaleS(14),
    paddingVertical: ScaleS(5),
    borderRadius: ScaleS(15),
    backgroundColor: '#FFF9E9'
  },
  preview: {
    color: '#FFC61C',
    fontSize: ScaleT(14),
    fontWeight: '500'
  }
})
